<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-12 10:52:50
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-02-28 17:00:48
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\insurance-management\\components\\list\\list.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 搜索表单 -->
<!-- <page-header-wrapper [title]="''"> </page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
      <div nz-col [nzSpan]="_$expand ? 24 : 18">
        <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
      </div>
      <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
        <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="search()" acl  [acl-ability]="['INSURANCE-LIST-search']">查询</button>
        <button nz-button nzType="primary" [disabled]="false" acl  [acl-ability]="['INSURANCE-LIST-export']" (click)="exprot()">导出</button>
        <button nz-button [disabled]="false" (click)="resetSF()">重置</button>
        <button nz-button nzType="link" (click)="expandToggle()">
          {{ !_$expand ? '展开' : '收起' }}
          <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
        </button>
      </div>
  </div>
</nz-card> -->

<nz-card class="table-box">
  <div class="tab_header">
    <label class="page_title"> <label class="driver">|</label> 保险列表</label>
    <nz-tabset  (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
      <nz-tab [nzTitle]="'全部(' + tabs?.totalCount + ')'"></nz-tab>
      <nz-tab [nzTitle]="'待投保(' + tabs?.receivedQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'已投保(' + tabs?.stayQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'投保失败(' + tabs?.GoingQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'已取消(' + tabs?.cancelQuantity + ')'"></nz-tab>
    </nz-tabset>
  </div>

  <st #st [bordered]="true" [scroll]="{ x: '2000px',y:scrollY }" [data]="service.$api_premiumInfo_list"
    [columns]="columns" [req]="{ params: reqParams }" [page]="{  }" [loading]="false">
    <ng-template st-row="resourceCode" let-item let-index="index">
      {{ item.resourceCode | currency }}
    </ng-template>
    <ng-template st-row="practicalPremium" let-item let-index="index">
      {{ item.practicalPremium | currency }}
    </ng-template>
    <ng-template st-row="insureAmount" let-item let-index="index">
      {{ item.insureAmount | currency }}
    </ng-template>
    <ng-template st-row="premium" let-item let-index="index">
      {{ item.premium | currency }}
    </ng-template>
    <ng-template st-row="processMessage" let-item let-index="index">
      {{ item.processResult == '2' ? item.processMessage : '' }}
    </ng-template>
    <ng-template st-row="driverName" let-item let-index="index">
      <div> {{ item?.driverName }}/{{ item?.driverTelephone }}/{{ item?.carNo }} </div>
    </ng-template>
    <ng-template st-row="distance" let-item let-index="index">
      <div>
        {{ item?.distance ? ((item?.distance)/1000).toFixed(4) + '公里' : '' }}
      </div>
    </ng-template>
    <ng-template st-row="goodsNumber" let-item let-index="index">
      <div>
        {{ item?.billCode }}
      </div>
    </ng-template>
    <ng-template st-row="resourceCode" let-item let-index="index">
      <div>
        {{ item?.resourceCode }}
      </div>
      <div>
        {{ item?.resourceStatusLabel }}
      </div>
    </ng-template>
    <ng-template st-row="insureCode" let-item let-index="index">
      <div>{{ item.insureCode }}</div>
      <div>
        <span>{{ item?.insureStatusLabel }}</span>
      </div>
    </ng-template>
    <ng-template st-row="goodsName" let-item let-index="index">
      <div>{{ item?.goodsInfoName }}</div>
      <div>
        <span>{{ item?.weight ? item?.weight + '吨/' : '' }}</span>
        <span>{{ item?.volume ? item?.volume + '方' : '' }}</span>
        <span>{{ item?.number ? item?.number + '件' : '' }}</span>
      </div>
    </ng-template>
    <ng-template st-row="mybidDetailInfo" let-item let-index="index">
      <div *ngIf="item.mybidDetailInfo?.length > 0">
        <p *ngFor="let data of item.mybidDetailInfo">
          {{ data.expenseName }}：{{ data.price | currency }}
          <span *ngIf="data.paymentStatusLabel" style="color: #f59a63">{{ data.paymentStatusLabel }}</span>
        </p>
      </div>
    </ng-template>
  </st>
</nz-card>

<ng-template #extraTemplate>
  <div class="mr-sm">
    <button nz-button nzDanger [nzLoading]="service.http.loading" (click)="openDrawer()" acl
      [acl-ability]="['INSURANCE-LIST-search']">筛选</button>
    <button nz-button nzDanger acl [acl-ability]="['INSURANCE-LIST-export']" (click)="exprot()"> 导出</button>
    <button nz-button nzType="primary" (click)="changeOrder()" acl [acl-ability]="['INSURANCE-LIST-insuranceConfig']">
      保险配置 </button>
  </div>
</ng-template>